<?php
/**
*This implements a simple cover page that can contain a list of boxes.
*@package Page
*@todo manage multiple covers...
*@todo should be more user friendly to have PageCover BE the list instead of having a list inside?
*/
Box::$description["Box_CoverPage"] = "The Cover Page";

class Box_CoverPage extends Box
{
	static public function DrawCover()
	{
		$covers = AtomCache::GetAtoms(array("cover_page"));
		if ( ($cover_atom = reset( $covers )) === false )
			$cover_atom = new Atom( array("cover_page"), new Box_CoverPage() );
		$cover = $cover_atom->LoadData();
		$page = new Html();
		$page->GeneratePage( $cover );
	}
	private $contents = false;
	protected function __construct()
	{
		parent::__construct(I18N("Page Cover"),"inline",'string:{include file="core:box" atom_id=$data.contents}' );
	}
	protected function PostInitialize()
	{
		$this->contents = Box::Create("Box_List", I18N("Cover contents"),array("cover"));
	}
	protected function ProcessData( $data )
	{
		$data["data"]["contents"] = $this->contents;
		return $data;
	}
}
?>